﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Frame.Lib.Core.Base;
using Cms.Entity.Menu;


namespace Cms.DAL.Menu
{
    public class MenuDAL : BaseDAL
    {      
       

        //public List<MenuInfo> GetListByCompany(int companyID)
        //{
        //    string sql = "select * from CmsMenu where CompanyID=@p0";
        //    List<MenuInfo> list = dbOper.Query<MenuInfo>(sql, companyID);
        //    return list;
        //}

        //public bool HasMenus(int companyID)
        //{
        //    string sql = "select count(*) from CmsMenu where CompanyID=@p0";
        //    int count = dbOper.GetScalar<int>(sql, companyID);
        //    return count > 0;
        //}

        //public void DeleteByCompany(IEnumerable<int> companyIDs)
        //{
        //    string ids = ConvertUtil.ConvertToDbStr(companyIDs);
        //    string sql = "delete from CmsMenu where CompanyID in (" + ids + ")";
        //    dbOper.RunSql(sql);
        //}
        public MenuInfo GetInfoByCode(int menuCode)
        {
            string sql = "select * from " + CTableName.Menu + " where Code=@p0";
            return dbOper.Query<MenuInfo>(sql, menuCode).FirstOrDefault();
        }
    }

}
